#!/usr/bin/python3
# _*_ coding:utf-8 _*_


def permutation(s, level):
    ls = list(s)
    if len(ls) == level:
        print(ls)
    for i in range(level, len(ls)):
        ls[level], ls[i] = ls[i], ls[level]
        permutation(ls, level + 1)
        ls[level], ls[i] = ls[i], ls[level]


st = 'zfy'
permutation(st, 0)

